home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / reuse.lha / reuse / m2c / Source.c < prev    next >
C/C++ Source or Header  |  1992-08-18  |  1KB  |  78 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_System
  4. #include "System.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_Source
  8. #include "Source.h"
  9. #endif
  10.  
  11.  
  12. #define IgnoreChar    ' '
  13. struct S_2 {
  14.     CHAR A[30000 + 1];
  15. };
  16.  
  17.  
  18. System_tFile Source_BeginSource
  19. # ifdef __STDC__
  20. (CHAR FileName[], LONGCARD O_1)
  21. # else
  22. (FileName, O_1)
  23. CHAR FileName[];
  24. LONGCARD O_1;
  25. # endif
  26. {
  27.   OPEN_ARRAY_LOCALS
  28.  
  29.   ALLOC_OPEN_ARRAYS(O_1 * sizeof(CHAR), 1)
  30.   COPY_OPEN_ARRAY(FileName, O_1, CHAR)
  31.   {
  32.     System_tFile R_1 = OpenInput(FileName, O_1);
  33.  
  34.     FREE_OPEN_ARRAYS
  35.     return R_1;
  36.   }
  37. }
  38.  
  39. INTEGER Source_GetLine
  40. # ifdef __STDC__
  41. (System_tFile File, ADDRESS Buffer, CARDINAL Size)
  42. # else
  43. (File, Buffer, Size)
  44. System_tFile File;
  45. ADDRESS Buffer;
  46. CARDINAL Size;
  47. # endif
  48. {
  49.   INTEGER n;
  50.   struct S_2 *BufferPtr;
  51.  
  52.   return Read(File, Buffer, Size);
  53. }
  54.  
  55. void Source_CloseSource
  56. # ifdef __STDC__
  57. (System_tFile File)
  58. # else
  59. (File)
  60. System_tFile File;
  61. # endif
  62. {
  63.   Close(File);
  64. }
  65.  
  66. void BEGIN_Source()
  67. {
  68.   static BOOLEAN has_been_called = FALSE;
  69.  
  70.   if (!has_been_called) {
  71.     has_been_called = TRUE;
  72.  
  73.     BEGIN_System();
  74.     BEGIN_System();
  75.  
  76.   }
  77. }
  78.